package com.mxpio.erp.common.technology.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;

import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_TECHNOLOGY_BOM_AUDIT")
@Schema(description="Bom_audit")
public class BomInfoAudit extends BaseEntity{

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "BOM_ID_", updatable = false)
	@Generator(policy = UUIDPolicy.class)
	@Schema(description = "Bom主键")
	private String bomId;

	@Column(name = "TMP_CRUD_TYPE_")
	@Schema(description = "数据状态")
	private String tmpCrudType;

	@Column(name = "PARENT_CODE_")
	@Schema(description = "父项物料编号")
	private String parentCode;

	@Column(name = "PARENT_NAME_")
	@Schema(description = "父项物料名称")
	private String parentName;

	@Column(name = "PARENT_SPEC_")
	@Schema(description = "父项物料型号")
	private String parentSpec;

	@Column(name = "PARENT_UNIT_")
	@Schema(description = "父项物料单位")
	@Dict(dicCode="ERP_TECH_UNIT_CODE")
	private String parentUnit;

	@Column(name = "PARENT_DRAWING_NO_")
	@Schema(description = "父项图号")
	private String parentDrawingNo;

	@Column(name = "PARENT_GROUP_")
	@Schema(description = "父项物料组")
	@Dict(dicCode="groupCode", dicEntity = ItemGroup.class, dicText = "groupName")
	private String parentGroup;

	@Column(name = "BASIC_CONSUMPTION_",precision = 19,scale = 6)
	@Schema(description = "基础用量")
	private BigDecimal basicConsumption = BigDecimal.ONE;

	@Column(name = "LEVEL_CODE_")
	@Schema(description = "阶层码")
	private String levelCode;

	@Column(name = "BOM_TYPE_")
	@Schema(description = "BOM类型")
	@Dict(dicCode="ERP_TECH_BOM_TYPE")
	private String bomType;

	@Column(name = "USE_TYPE_")
	@Schema(description = "使用状态")
	@Dict(dicCode="ERP_TECH_USE_TYPE")
	private String useType;

	@Column(name = "VERSION_")
	@Schema(description = "BOM版本")
	private String version;

	@Column(name = "BEGIN_TIME_")
	@Schema(description = "生效日期")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date beginTime;

	@Column(name = "END_TIME_")
	@Schema(description = "失效日期")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date endTime;

	@Column(name = "CHANGE_CODE_")
	@Schema(description = "变更单号")
	@Generator(policy = ResCodeGeneratorPolicy.class)
	private String changeCode;

	@Column(name = "CHANGE_MAN_")
	@Schema(description = "变更人")
	@Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
	private String changeMan;

	@Column(name = "CHANGE_DATE_")
	@Schema(description = "变更日期")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date changeDate;

	@Column(name = "CHANGE_MEMO_")
	@Schema(description = "变更说明")
	private String changeMemo;

	@Column(name = "AGREE_")
	@Schema(description = "是否同意")
	private String agree;

	@Column(name = "AUDIT_OPINION_")
	@Schema(description = "审核意见")
	private String auditOpinion;

	@Transient
	private List<BomInfoLineAudit> bomInfoLineList;



}
